def jiecheng(n):
    if n == 0:
        return 1
    elif n == 1:
        return 1
    else:
        return n * jiecheng(n-1)
#解法1
# a = []
# for i in range(6):
#     a.append(jiecheng(i))
# print(sum(a))
#解法2
# s = 0
# for i in range(6):
#     s += jiecheng(i)
# print(s)

#逆向输出字符串,解法1
def rev1(s):
    a = []
    for i in s:
        a.append(i)
    a.reverse()
    return a
print(''.join(rev1('床前明月光')))
#解法2
def rev2(s):
    #return s[-1:-len(s)-1:-1]
    return s[::-1]
print(rev2('床前明月光'))
